package com.future.direction.ui.fragment;


import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.liaoinstan.springview.container.DefaultFooter;
import com.liaoinstan.springview.container.DefaultHeader;
import com.liaoinstan.springview.widget.SpringView;
import com.future.direction.R;
import com.future.direction.data.bean.CourseInteractionBean;
import com.future.direction.di.component.AppComponent;
import com.future.direction.ui.adapter.CourseInteractionAdapter;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by xwl on 2019/11/12
 * 课程详情-互动
 */
public class CourseDetailsInteractionFragment extends BaseFragment {

    @BindView(R.id.recycle_interaction)
    RecyclerView recycleInteraction;
    @BindView(R.id.springView)
    SpringView springView;
    private CourseInteractionAdapter interactionAdapter;
    private ArrayList<CourseInteractionBean> courseInteractionBeans;

    @Override
    public int setLayout() {
        return R.layout.fragment_course_details_interaction;
    }

    @Override
    protected void getExtras() {

    }

    @Override
    public void init() {
        springView.setHeader(new DefaultHeader(getContext()));//设置刷新头
        springView.setFooter(new DefaultFooter(getContext()));//设置加载尾
        initRecycler();
    }

    private void initRecycler() {
        courseInteractionBeans = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            CourseInteractionBean courseInteractionBean = new CourseInteractionBean();
            courseInteractionBean.setNickName("木目");
            courseInteractionBean.setDate("09-05 21:00");
            courseInteractionBean.setComment("讲得真心不错");
            courseInteractionBeans.add(courseInteractionBean);
        }
        LinearLayoutManager manager = new LinearLayoutManager(getContext());
        recycleInteraction.setLayoutManager(manager);
        interactionAdapter = new CourseInteractionAdapter(R.layout.item_course_interaction, courseInteractionBeans);
        recycleInteraction.setAdapter(interactionAdapter);
    }

    @Override
    protected void setListener() {

    }

    @Override
    public void setupAcitivtyComponent(AppComponent appComponent) {

    }


}
